<?php
/*
 * Created on Apr 2, 2006
 *
 */
 
require_once('sql_connection.php');

class Sql_offense extends Sql_connection {

    function __construct() {
        parent :: __construct();
    }

    function get_offenses() {

        $query = "SELECT offense FROM Offense ORDER BY offense ASC";

        return column_as_array(mysql_query($query));

    }

    function exists($offense) {
        $offense = mysql_input($offense);
        $query = "SELECT offense FROM Offense WHERE offense = '$offense'";

        $result = mysql_query($query);
        if (!$result)
            die ("sql_offense-> exists() DB error: " . mysql_error());

        if (mysql_num_rows($result) > 0)
            return true;
        else
            return false;	 	
    }


 	
 }
?>
